doctype html
html(lang="en")
	head
		meta(charset="utf-8")
		meta(name="viewport", content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, shrink-to-fit=no")
		
		if (session.uiTheme && session.uiTheme == "dark")
			link(rel="stylesheet", href="/css/bootstrap-dark.css")

			style.
				hr { background-color: #555555; }
		else
			link(rel="stylesheet", href="/css/bootstrap.min.css", integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4", crossorigin="anonymous")
		
		link(rel="stylesheet", href="/css/ub.css")
		link(rel="stylesheet", href="/css/default.min.css")
		link(rel="stylesheet", href="/css/radial-progress.css", type="text/css")
		link(rel='stylesheet', href='/css/styling.css')

		link(rel="icon", type="image/png", href=("/img/logo/" + config.coin.toLowerCase() + ".png"))

		block headContent
			title Explorer
		
	body
		nav(class="navbar navbar-expand-lg navbar-dark bg-dark mb-4")
			div(class="container")
				a(class="navbar-brand", href="/")
					span
						if (coinConfig.logoUrl)
							img(src=coinConfig.logoUrl, class="header-image", alt="logo")
						span #{coinConfig.siteTitle}
						
				button(type="button", class="navbar-toggler navbar-toggler-right", data-toggle="collapse", data-target="#navbarNav", aria-label="collapse navigation")
					span(class="navbar-toggler-icon")
					
				div(class="collapse navbar-collapse", id="navbarNav")
					if (client)
						ul(class="navbar-nav mr-auto")
							li(class="nav-item")
								a(href="/about", class="nav-link")
									span About

							if (config.siteTools)
								li(class="nav-item dropdown")
									a(class="nav-link dropdown-toggle", href="javascript:void(0)", role="button", data-toggle="dropdown", aria-haspopup="true", aria-expanded="false") 
										span  Tools
									div(class="dropdown-menu", aria-label="Tools Items")
										each item in config.siteTools
											a(class="dropdown-item", href=item.url)
												i(class=item.fontawesome, style="width: 20px; margin-right: 10px;")
												span  #{item.name}

								li(class="nav-item")
								a(href="/tokens", class="nav-link")
									span Tokens

							li(class="nav-item dropdown")
								a(class="nav-link dropdown-toggle", href="javascript:void(0)", id="navbarDropdown", role="button", data-toggle="dropdown", aria-haspopup="true", aria-expanded="false") 
									i(class="fas fa-cog")
									span  Settings
								div(class="dropdown-menu", aria-labelledby="navbarDropdown")
									if (coinConfig.currencyUnits)
										span(class="dropdown-header") Currency Units
										each item in coinConfig.currencyUnits
											a(class="dropdown-item", href=("/changeSetting?name=currencyFormatType&value=" + item.values[0]))
												each valueName in item.values
													if (currencyFormatType == valueName)
														i(class="fas fa-check")
												span  #{item.name}

									span(class="dropdown-header") Theme
									a(class="dropdown-item", href="/changeSetting?name=uiTheme&value=light")
										if (session.uiTheme == "light" )
											i(class="fas fa-check")
										span  Light
									a(class="dropdown-item", href="/changeSetting?name=uiTheme&value=dark")
										if (session.uiTheme == "dark"|| session.uiTheme == "")
											i(class="fas fa-check")
										span  Dark

						form(method="post", action="/search", class="form-inline")
							div(class="input-group input-group-sm")
								input(type="text", class="form-control form-control-sm", name="query", placeholder="block height/hash, txid, address", value=(query), style="width: 300px;")
								div(class="input-group-append")
									button(type="submit", class="btn btn-primary")
										i(class="fas fa-search")
		
		if (host && port && !homepage)
			div(id="sub-menu", class="container mb-4", style="margin-top: -1.0rem;")
				ul(class="nav")
					each item, index in config.siteTools
						li(class="nav-item")
							a(href=item.url, class="nav-link")
								span #{item.name}
					

				hr
				
		div(class="container")
			if (userMessage)
				div(class="alert", class=(userMessageType ? ("alert-"  + userMessageType) : "alert-warning"), role="alert")
					span !{userMessage}
			
			block content

			div(style="margin-bottom: 30px;")

			footer(class="footer bg-dark text-light pt-3 pb-1 px-3", style="margin-top: 50px;")
				div(class="container")
					div(class="row")
						div(class="col-md-5")
							dl
								dt Source
								dd
									a(href="https://https://gitee.com/zhanghoufu/pkc-rpc-explorer") https://gitee.com/zhanghoufu/pkc-rpc-explorer

								dt Running Version
								dd
									a(href=("https://https://gitee.com/zhanghoufu/pkc-rpc-explorer/commit/" + sourcecodeVersion)) #{sourcecodeVersion}
									span(style="color: #ccc;")  (#{sourcecodeDate})

								if (!config.demoSite)
									dt Public Demos
									dd
										if (coinConfig.demoSiteUrl)
											a(href=coinConfig.demoSiteUrl) #{coinConfig.demoSiteUrl}
										else
											a(href="https://btc-explorer.chaintools.io") https://btc-explorer.chaintools.io
										
										div(class="mt-2")
											- var demoSiteCoins = ["BTC", "LTC"];
											each demoSiteCoin in demoSiteCoins
												a(href=coinConfigs[demoSiteCoin].demoSiteUrl, class="mr-2", title=coinConfigs[demoSiteCoin].siteTitle)
													img(src=("/img/logo/" + demoSiteCoin.toLowerCase() + ".svg"), alt=demoSiteCoin.toLowerCase())

											a(href="https://lightning.chaintools.io", class="mr-2", title="Lightning Explorer")
												img(src=("/img/logo/lightning.svg"), style="width: 32px; height: 32px;", alt="lightning")

						div(class="col-md-7 text-md-right")
							dl
								dt Support Development of #{coinConfig.siteTitle}
								dd
									div(class="text-md-right text-center")
										each coin, index in config.donationAddresses.coins
											div(style="display: inline-block; max-width: 150px;", class="text-center mb-3 word-wrap monospace", class=(index > 0 ? "ml-md-3" : false))
												img(src=donationAddressQrCodeUrls[coin], alt=config.donationAddresses[coin].address, style="border: solid 1px #ccc;")
												br
												if (coinConfig.ticker == coin)
													span #{coin}: 
													a(href=("/address/" + config.donationAddresses[coin].address)) #{config.donationAddresses[coin].address}
												else
													span #{coin}: 
													a(href=(config.donationAddresses.sites[coin] + "/address/" + config.donationAddresses[coin].address)) #{config.donationAddresses[coin].address}
		
		script(src="/js/jquery-3.3.1.min.js", integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=", crossorigin="anonymous")
		script(src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js", integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ", crossorigin="anonymous")
		script(src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js", integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb", crossorigin="anonymous")
		script(src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js", integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm", crossorigin="anonymous")
		script(defer, src="/js/all.js", integrity="sha384-4oV5EgaV02iISL2ban6c/RmotsABqE4yZxZLcYMAdG7FAPsyHYAPpywE9PJo+Khy", crossorigin="anonymous")

		script(src="/js/highlight.min.js")
		
		script.
			$(document).ready(function() {
				$('[data-toggle="tooltip"]').tooltip();
				$('[data-toggle="popover"]').popover({html:true, container:"body"});
			});

			hljs.initHighlightingOnLoad();

		if (config.credentials.sentryUrl && config.credentials.sentryUrl.length > 0)
			script(src="https://browser.sentry-cdn.com/4.0.4/bundle.min.js", crossorigin="anonymous")
			script.
				Sentry.init({ dsn: '#{config.credentials.sentryUrl}' });

		if (config.credentials.googleAnalyticsTrackingId && config.credentials.googleAnalyticsTrackingId.trim().length > 0)
			script(async, src=("https://www.googletagmanager.com/gtag/js?id=" + config.credentials.googleAnalyticsTrackingId))
			script.
				window.dataLayer = window.dataLayer || [];
				function gtag(){dataLayer.push(arguments);}
				gtag('js', new Date());

				gtag('config', '#{config.credentials.googleAnalyticsTrackingId}');

		
		block endOfBody
